import request from "@/utils/request";
import { uaaUrl } from "@/utils/request";

// 查询岗位列表
export function listPost(query) {
  return request({
    url: uaaUrl() + "api-system/v1/sysPost/sysPostListPage",
    method: "get",
    params: query,
  });
}
// 角色数据权限
export function dataScope(data) {
  return request({
    url: uaaUrl() + "api-system/v1/sysPost/dataScope",
    method: "put",
    data: data,
  });
}

export function getRole(roleId) {
  return request({
    url: uaaUrl() + "api-system/v1/sysDept/postDeptTreeselect/" + roleId,
    method: "get",
  });
}

// 查询岗位详细
export function getPost(postId) {
  return request({
    url: uaaUrl() + "api-system/v1/sysPost/" + postId,
    method: "get",
  });
}
// 查询部门下拉树结构
export function treeselectDept() {
  return request({
    url: uaaUrl() + "api-system/v1/sysDept/treeselectDept",
    method: "get",
  });
}
// 查询上级岗位
export function treeselectPost(deptId) {
  return request({
    url: uaaUrl() + "api-system/v1/sysPost/postParent?deptId=" + deptId,
    method: "get",
  });
}
// 查询岗位职级
export function postCodeList() {
  return request({
    url: uaaUrl() + "api-system/v1/sysPost/postCodeList",
    method: "get",
  });
}
// 新增岗位
export function addPost(data) {
  return request({
    url: uaaUrl() + "api-system/v1/sysPost",
    method: "post",
    data: data,
  });
}

// 修改岗位
export function updatePost(data) {
  return request({
    url: uaaUrl() + "api-system/v1/sysPost",
    method: "put",
    data: data,
  });
}

// 删除岗位
export function delPost(postId) {
  return request({
    url: uaaUrl() + "api-system/v1/sysPost/" + postId,
    method: "delete",
  });
}
// initPost
export function initPost() {
  return request({
    url: uaaUrl() + "api-system/v1/sysPost/initPost",
    method: "get",
  });
}
